home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2010 Summer - Disc 1
/
WN_Ete2010_CD1.iso
/
Onglet5
/
Weezo
/
Weezo setup.exe
/
{code_appDir}
/
www
/
res
/
administration
/
config
/
password.php
< prev
next >
Wrap
PHP Script
|
2010-05-19
|
6KB
|
154 lines
<?php
/**
* Accounts remote configuration
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category NA
* @package NA
* @author Nicolas Bruley / Peer 2 World <contact@weezo.net>
* @copyright 2005-2009 Nicolas Bruley / Peer 2 World
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
* @link http://www.weezo.net
* @since File available since Release 2.0.0
*/
require(INCLUDE_DIR.'outputFunctions.php');
if(cfUGetVar('accountType')!='singleUser') die('unauthorized access');
/*
***************************************************************************************************************************
* Process POST commands
***************************************************************************************************************************
*/
if(isset($_POST['cPwds'])){
$plainText=cfRSADecrypt($_POST['cPwds']);
if(strpos($plainText,'/new:') && cfCmpLeft($plainText,'prev:')){
$prev=substr($plainText,5,strpos($plainText,'/new:')-5);
if(cfUGetVar('authenticationMethod')=='password' && md5($prev)!=cfUGetVar('password')){
$errorMessage=cfCaption('loginBadPassword');
}
else{
$new=substr($plainText,strpos($plainText,'/new:')+5);
if(strlen($new)>0){
require_once(INCLUDE_DIR.'resourceConfigFunctions.php');
rcUserSaveValues(array('authenticationMethod'=>'password', 'password'=>md5($new)));
cfUSetVar('authenticationMethod','password');
cfUSetVar('password',md5($new));
cfInsertHEAD();
?>
<body>
<?php echo outDivFrame('frame1');?>
<div class="frame1Header"><?php echo cfCaption('genPasswordNew');?></div>
<br><br><br>
<center>
<?php echo cfCaption('passwordChanged');?>
</center>
<br><br>
<center>
<?php echo outButton(cfCaption('genClose'),'javascript:winMe.closeMe()',outIcon('close'));?>
<?php echo outKeyHandler('D',array('27'=>'winMe.closeMe()','13'=>'winMe.closeMe()'),true)?>
</center>
</div>
</body>
<?php
exit;
}
}
}
}
/*
***************************************************************************************************************************
* Display page
***************************************************************************************************************************
*/
cfInsertHEAD(false);
echo outRSAScripts();
?>
<script type="text/javascript">
function togglePwdShow(){
if(dgi("showPwd").checked){
dgi("newConfTd").style.visibility="hidden";
try{dgi("new").type="text"}catch(e){dgi("new").outerHTML='<input type="text" id="new" value="'+dgi("new").value+'">'}
dgi("prev").style.width="100%";
}
else{
dgi("newConfTd").style.visibility="";
try{dgi("new").type="password"}catch(e){dgi("new").outerHTML='<input type="password" id="new" value="'+dgi("new").value+'">'}
dgi("prev").style.width="100%";
}
val();
}
function togglePwdShowClick(){
dgi("showPwd").checked=!dgi("showPwd").checked;
togglePwdShow();
}
function init(){
dgi("prev").focus();
winMe.resizeInnerTo(0,actualOffsetBottom(dgi("mainFrame"))+10);
winMe.freezeSize();
}
function val(){
var v=1;
if(!dgi("prev").value) v=0;
if(!dgi("new").value) v=0;
if((!dgi("showPwd").checked) && dgi("new").value!=dgi("newConf").value) v=0;
if(v) wl.button.enable("goBt"); else wl.button.disable("goBt");
return v;
}
function go(){
RSACrypt('prev:'+dgi('prev').value+'/new:'+dgi('new').value,goProceed,dgi("progress"));
}
function goProceed(c){
dgn("cPwds").value=c;
dgi("cPwdsForm").submit();
}
</script>
</head>
<body onload="init()">
<?php echo outDivFrame('frame1','id="mainFrame"');
echo outFrameHeaderTable('frame1Header',cfCaption('genPasswordNew'),'<span id="progress"> </span>');
echo outTableTransparent();
echo '<tr><td style="width:50%;white-space:nowrap">'.cfCaption('passwordCurrent').' </td><td><input type="password" id="prev" name="prev" style="width:100%"></td></tr>';
echo '<tr><td style="width:50%;white-space:nowrap">'.cfCaption('passwordNew').' </td><td><input type="password" id="new" name="prevConf" style="width:100%"></td></tr>';
echo '<tr id="newConfTd"><td style="width:50%;white-space:nowrap">'.cfCaption('genConfirm').' </td><td><input type="password" id="newConf" name="newConf" style="width:100%"></td></tr>';
echo '<tr><td colspan="2" style="text-align:right"><input type="checkbox" id="showPwd" onclick="togglePwdShow()"> <span onclick="togglePwdShowClick()">'.cfCaption('passwordShow').'</span></td></tr>';
?>
</table>
<form method="POST" enctype="multipart/form-data" style="display:none" id="cPwdsForm">
<input name="cPwds">
</form>
<center>
<?php
echo '<div class="warning">'.((isset($errorMessage))?$errorMessage:' ').'</div>';
echo outButton(cfCaption('explorerAudioApply'),'javascript:go()',outIcon('ok'),false,'goBt',false,false,true);
echo outButton(cfCaption('genCancel'),'javascript:winMe.closeMe()',outIcon('cancel'));
?>
</center>
<script type="text/javascript">
dgi("prev").onkeyup=function (e){val();if(wl.eventKC(e)==13) dgi("new").focus()}
dgi("new").onkeyup=function (e){
if(wl.eventKC(e)==13) {
if(dgi("showPwd").checked && val()) go();
if(!dgi("showPwd").checked) dgi("newConf").focus();
}
else val();
}
dgi("newConf").onkeyup=function (e){if(val()&&wl.eventKC(e)==13) go()}
<?php echo outKeyHandler('D',array('27'=>'winMe.closeMe()'));?>
</script>
</div>
</body>